//
//  TsfDetailModel.m
//  TenMinDemo
//
//  Created by Shawn Li on 2021/3/17.
//  Copyright © 2021 CYXiang. All rights reserved.
//

#import "TsfDetailModel.h"
#import "DateTool.h"

@implementation TsfDetailModel

+ (NSDictionary *)mj_replacedKeyFromPropertyName{
    return @{@"hashCode":@"hash"};
}

- (void)configInfoList{
    BOOL isSend = [self.type isEqualToString:@"SEND"];
    BOOL isSuccess = NO;
    NSString *state = [self.status isEqualToString:@"Success"] ? @"已完成" : [self.status isEqualToString:@"Faild"] ? @"失败" : @"确认中";
    NSMutableArray *info = @[
        @{@"title":@"交易类型",@"info":isSend?@"转出":@"转入"},
        @{@"title":@"状态",@"info":state},
        @{@"title":@"收款地址",@"info":LCSafeStr(self.fromAddress)},
        @{@"title":@"付款地址",@"info":LCSafeStr(self.toAddress)},
    ].mutableCopy;
    if (isSuccess) {
        [info addObject:@{
            @"title":@"区块链交易ID",@"info":LCSafeStr(self.hashCode)
        }];
    }
    if (self.remark && self.remark.length) {
        [info addObject:@{
            @"title":@"备注",@"info":self.remark,
        }];
    }
    NSString *time = [DateTool timeDetailYearStrWithTime:self.txTime];
    [info addObject:@{
        @"title":@"时间",@"info":time,
    }];
    
    self.infoList = info;
}

@end
